import API from "@utils/request";

const COMMON = "/common/";

/**
 * 文件上传
 * @param {file} file
 */
export async function uploadFile(file) {
  console.log(file);
  try {
    const formData = new FormData();
    formData.append("avatarfile", file, file.name);

    return await API.post("/system/user/profile/uploadAvatar", formData, {
      transformRequest: [
        function (data) {
          return data;
        },
      ],
    });
  } catch (error) {
    return error;
  }
}


